﻿// ----------------------------------------------------------------------------------------
// Author:                    Magaly Vargas y Joaquín López
// Company:                   ALBALIA INTERACTIVA S.L.
// Assembly version:          1.0.0.0
// Date:                      22/02/2010
// Time:                      12:00
// Solution Name:             OffInvoiceWordTemplate
// Solution Filename:         OffInvoiceWordTemplate
// Solution FullFilename:     C:\Desarrollo\OffInvoiceWordTemplate
// Project Name:              OffInvoiceWordTemplate
// Project Filename:          OffInvoiceWordTemplate.csproj
// Project FullFilename:      C:\Desarrollo\OffInvoiceWordTemplate\OffInvoiceWordTemplate.csproj
// Project Item Name:         Loader.cs
// Project Item Filename:     Loader.cs
// Project Item FullFilename: C:\Desarrollo\OffInvoiceWordTemplate\Loader.cs
// Project Item Kind:         Código
// Purpose:                   
//Copyright © 2009 - 2010 Albalia Interactiva S.L. Reservados todos los derechos.
// ----------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace OffInvoiceWordTemplate
{
    public static class Loader
    {

        /// <summary>
        /// Carga la etiqueta correspondiente a cada control, segun su tag.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        public static string LoadLabel(string path, string tag)
        {
            string label = " ";
            try
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(path);
                string lb = xmldoc.GetElementsByTagName(tag).Item(0).InnerText;
                if (!string.IsNullOrEmpty(lb))
                    label = lb;

                return label;

            }
            catch (Exception)
            {
                return label;
            }
        }


    }
}
